<style>
table.tecspec {
  width: 100%;
  max-width: 100%;
  border-bottom: 1px solid #dddddd;
}
table.tecspec>tbody>tr>th {
  border-right: 1px solid #ddd;text-align: right;  padding-right: 14px;
}
table.tecspec>tbody>tr>th, table.tecspec>tbody>tr>td {
  padding-left: 12px;
  line-height: 1.42857143;
  vertical-align: top;
  border-top: 1px solid #ddd;
}
body{
    background-color:white;
}
.detail_booking{
    text-align: center;
    font-weight: bold;
}
textarea{width:564px !important;}
label{font-weight: bold !important;}
</style>

    <?php echo form_open(); ?>
    <!--<p class="detail_booking"><?php echo $this->lang->line("detail_booking");?></p>-->
    <table class="tecspec">
        <tbody>
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('customerID'), 'customerID');?></th>
              <td width="75%">
                  <?php echo $info->customerID;?>
                  <?php echo form_input(array('type'=>'hidden', 'name' => 'customerID', 'id' => 'customerID', 'value' => (isset($info->customerID))?$info->customerID:''));?>
              </td>
            </tr>
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('booking_place_code'), 'booking_place_code');?></th>
              <td width="75%"><?php echo $info->booking_place_code;?></td>
            </tr>
            
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('airline'), 'airline');?></th>
              <td width="75%"><?php echo $info->airline;?></td>
            </tr>
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('payment_method'), 'payment_name');?></th>
              <td width="75%"><?php echo $info->payment_name;?></td>
            </tr>
            
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('net_fare'), 'net_fare');?></th>
              <td width="75%"><?php echo $this->bookinglib->my_number_format($info->net_fare,2, ',', ',');?> VNĐ</td>
            </tr>
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('sale_fare'), 'sale_fare');?></th>
              <td width="75%"><?php echo $this->bookinglib->my_number_format($info->sale_fare,2, ',', ',');?> VNĐ</td>
            </tr>
            <?php
//            '<br/>'.$this->lang->line('child').': '.$info->booking_child
            if($info->booking_child){
                $child = '<br/>'.$this->lang->line('child').': '.$info->booking_child;
            } else {
                $child = '';
            }
            ?>
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('customersName'), 'booking_customer_name');?></th>
              <td width="75%"><?php echo str_replace('||', '<br/>', $info->booking_customer_name).$child;?></td>
            </tr>
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('ship'), 'ship');?></th>
              <td width="75%"><?php echo implode("<br/>",json_decode($info->booking));?></td>
            </tr>
            
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('createdTime'), 'createdTime');?></th>
              <td width="75%"><?php echo date('d-m-Y H:i:s',$info->createdTime);?></td>
            </tr>
            
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('lastupdated'), 'lastupdated');?></th>
              <td width="75%"><?php echo date('d-m-Y H:i:s',$info->lastupdated);?></td>
            </tr>
            
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('dkve'), 'dkve');?></th>
              <td width="75%"><?php echo form_textarea(array('name' => 'dkve', 'id' => 'dkve', 'value' => $info->dkve,'rows'=>'3','cols'=>'2280'));?></td>
            </tr>
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('dkhanhly'), 'dkhanhly');?></th>
              <td width="75%"><?php echo form_textarea(array('name' => 'dkhanhly', 'id' => 'dkhanhly', 'value' => $info->dkhanhly,'rows'=>'3','cols'=>'280'));?></td>
            </tr>
            <tr>
              <th style="width:25%"></th>
              <td width="75%">
<?php 
    echo form_checkbox(array('name'=>'condition_print','id'=>'condition_print','value'=>'1','checked'=>TRUE,'style'=>'vertical-align: top;')).form_label($this->lang->line('condition_print'), 'condition_print',array('style'=>'display:inline-block!important;cursor: pointer;'));
    echo '<br/>';
    echo form_checkbox(array('name'=>'hiddenCty','id'=>'hiddenCty','value'=>'0','checked'=>FALSE,'style'=>'vertical-align: top;')).form_label($this->lang->line('hiddenCty'), 'hiddenCty',array('style'=>'display:inline-block!important;cursor: pointer;'));
?>
              </td>
            </tr>
            <?php echo form_input(array('type'=>'hidden', 'name' => 'id', 'id' => 'id', 'value' => (isset($info->id))?$info->id:''));?>
            <tr class="btn-group">
              <th style="width:25%"></th>
              <td width="75%" style="text-align: center;">
                  <input type="hidden" value="<?php echo $info->customerID;?>" name="customerID" />
                  <?php echo form_button(array('id' => 'submit', 'value' => 'Update', 'name' => 'submit', 'type' => 'submit', 'content' => $this->lang->line('booking_print'),'class' => 'btn btn-primary'));?>
                  
                  <span style="padding:0 10px;"><?php echo form_button(array('id' => 'cancel','content' => $this->lang->line('close'),'class' => 'btn btn-danger')); ?></span>
              </td>
            </tr>
        </tbody>
    </table>
    <?php echo form_close(); ?>

<link rel="stylesheet" href="<?php echo base_url();?>third_party/bootstrap/css/bootstrap.min.css" />
<script src="<?php echo STATIC_URL.'libs/js/ajax.js'?>"></script>
<script>
$(document).ready(function() {
    $("#submit").on('click',function(e)
    {
        setTimeout(function () {
            $.ajax(
                {
                    url : '/auth/bookhistory/updateBill',
                    type: "POST",
                    data : { id: $("#id").val() ,dkve: $("#dkve").val(), dkhanhly: $("#dkhanhly").val(), condition_print: $("#condition_print").is(":checked"), hiddenCty: $("#hiddenCty").is(":checked") },
                    cache: true,
                    beforeSend: function(){

                    },
                    success:function(data) 
                    {
                        if(data){
                            window.top.location.href="/auth/bookhistory/printbill?s=1&id="+data;
                        }
                    },
                    error: function() 
                    {

                    }
                });
        }, 1000);
        e.preventDefault();	//STOP default action
    });
    
    $("#cancel").on('click',function(e){
            parent.jQuery.fancybox.close();
            e.preventDefault();	//STOP default action
    });
});
</script>